-- object.lua
-- Created by shenyq Mar/29/2011
-- common object class

Object = class()

-- if show debug info
Object.DEBUG = false;

function Object:__init(info)
    --[[
    -- object information
    if is_table(info) then
        info = table.deepclone(info);
    end
    --]]

    self._info = {};
end

-- query
function Object:query(info)
    if info == nil then
        return self._info;
    else
        return self._info[info];
    end
end

-- set
function Object:set(info, value)
   self._info[info] = value;
end

-- register part init function
function Object.register_part_init(class, func)
    class.part_initial_funcs = class.part_initial_funcs or {};
    table.insert(class.part_initial_funcs, func);
end

-- init parts of an object
function Object.init_parts(class, instance)
    for _, v in ipairs(class.part_initial_funcs) do
        v(instance);
    end
end

